<?php
class Userapprovemodel extends Model {
	function Userapprovemodel() {
		parent::Model();
	}
	function numrows() {
		$ql ="select a.*,b.dept_name from(user a,dept b) where a.dept_id=b.dept_id and status='0'";
		$q = $this->db->query($ql);
		return $q->num_rows();
		}
	function show_non_aktif($offset) {
		$this->db->select('a.user_id,a.name,a.email,a.status,b.dept_name');
		$this->db->from('user a,dept b');
		$this->db->where('a.dept_id  = b.dept_id');
		$this->db->where('a.status =0');
		$this->db->order_by('user_id','desc');
		$this->db->limit(10,$offset);
		
		return $this->db->get();
	}
	function numrows_2() {
		$ql ="select a.*,b.dept_name from(user a,dept b) where a.dept_id=b.dept_id and status='1'";
		$q = $this->db->query($ql);
		return $q->num_rows();
		}
	
	function show_user_aktif() {
		$this->db->select('a.user_id,a.name,a.email,a.status,b.dept_name');
		$this->db->from('user a,dept b');
		$this->db->where('a.dept_id  = b.dept_id');
		$this->db->where('a.status =1');
		$this->db->order_by('user_id','desc');
		//$this->db->limit(10,$offSet);
		return $this->db->get();
	}
	function update_aktif($id,$xp) {
		$this->db->where('user_id',$id);
		$this->db->update('user',$xp);
		
		
	}
	function update_non($id,$xp) {
		$this->db->where('user_id',$id);
		$this->db->update('user',$xp);
		
		
	}
}

?>